package com.markul.android.ui.main

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.baidu.mapapi.map.Marker
import com.baidu.mapapi.model.LatLng
import com.markul.android.logic.model.Repository
import com.markul.android.logic.model.room.PublicAlbum
import com.markul.android.logic.model.room.UserAndPublicRoomCrossRef
import com.markul.android.logic.room.User
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

class MainViewModel: ViewModel(){

    val markerList=ArrayList<Marker>()

    val albumIdList=ArrayList<Int>()

    fun addUser(user:User) {
        viewModelScope.launch(Dispatchers.IO) {
            Repository.addUser(user=user)
        }
    }

    fun addPublicAlbum(publicAlbum: PublicAlbum) {
        viewModelScope.launch(Dispatchers.IO) {
            Repository.addPublicAlbum(publicAlbum=publicAlbum)
        }
    }

    fun addCrossRef(crossRef: UserAndPublicRoomCrossRef) {
        viewModelScope.launch(Dispatchers.IO) {
            Repository.addCrossRef(crossRef)
        }
    }
}